<script setup lang="ts" name="MenuListProperty">
import { usePropertyForm } from '@/components/Designer/utils/index'
import { EMPTY_MENU_LIST_ITEM_PROPERTY, MenuListProperty } from './config'

/** 列表导航属性面板 */

const props = defineProps<{ modelValue: MenuListProperty }>()
const emit = defineEmits(['update:modelValue'])
const { formData } = usePropertyForm(props.modelValue, emit)
</script>

<template>
  <MallProperty v-model="formData.style">
    <ElText tag="p"> 菜单设置 </ElText>
    <ElText type="info" size="small"> 拖动左侧的小圆点可以调整顺序 </ElText>

    <!-- 表单 -->
    <ElForm label-width="60px" :model="formData" class="m-t-8px">
      <Draggable v-model="formData.list" :empty-item="EMPTY_MENU_LIST_ITEM_PROPERTY">
        <template #default="{ element }">
          <ElFormItem label="图标" prop="iconUrl">
            <UploadImage v-model="element.iconUrl" height="80px" width="80px">
              <template #tip> 建议尺寸：44 * 44 </template>
            </UploadImage>
          </ElFormItem>
          <ElFormItem label="标题" prop="title">
            <InputColorPicker v-model="element.title" v-model:color="element.titleColor" />
          </ElFormItem>
          <ElFormItem label="副标题" prop="subtitle">
            <InputColorPicker v-model="element.subtitle" v-model:color="element.subtitleColor" />
          </ElFormItem>
          <ElFormItem label="链接" prop="url">
            <MallAppLinkInput v-model="element.url" />
          </ElFormItem>
        </template>
      </Draggable>
    </ElForm>
  </MallProperty>
</template>

<style scoped lang="scss"></style>
